import http from '@ohos.net.http';
import router from '@system.router';

export default {
    data: {
        testPNG: "",
        imagesrc1: "/common/shouye/shouye1.png",
        imagesrc2: "/common/shouye/shouye2.png",
        imagesrc3: "/common/shouye/shouye3.png",
        imagesrc33: "/common/shouye/shouye33.png",
        imagesrc4: "/common/shouye/shouye4.png",
        imagesrc5: "/common/shouye/shouye5.png",
        imagesrc6: "/common/shouye/shouye6.png",
        imagesrc7: "/common/shouye/shouye7.png",
        imagesrc8: "/common/shouye/shouye8.png",
        imagesrc9: "/common/shouye/shouye9.png",
        imagesrc18: "/common/shouye/shouye10.png",
        imagesrc19: "/common/shouye/shouye11.jpg",
        imagesrc10: "/common/shouye/content1.png",
        imagesrc11: "/common/shouye/content2.png",
        imagesrc12: "/common/shouye/content3.png",
        imagesrc13: "/common/shouye/content4.png",
        imagesrc14: "/common/shouye/c1.png",
        imagesrc15: "/common/shouye/c2.png",
        imagesrc16: "/common/shouye/c3.png",
        imagesrc17: "/common/shouye/c4.png",
        title: 'World',
        badgeconfig: {
            badgeColor: "#696bf6",
            badgeSize: "10px"
        },
        neirong1: [],
        neirong3: [
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
        ],
        neirong5: [
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
            {
                imagesrc: "", text: ""
            },
        ],
        sit1: "",
        sit2: "",
        sit3: "",
        sit4: "",
        sit5: "",
        sit33: false,
    },
    onInit() {
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
        let httpRequest = http.createHttp();
        httpRequest.request(this.$app.$def.globalData.baseURL + "/content", {
            method: 'GET',
        }, (err, data) => {
            if (!err) {
                console.error('Result:' + data.result);
                this.neirong1 = JSON.parse(data.result);
                console.error('Neirong:'+this.neirong1);
            } else {
                console.log('error:' + err.data);
            }
        });
    },
    goBack() {
        router.back();
    },
    goToShangPin() {
        console.log("点击事件");
        router.push({
            uri: 'pages/shangpin/shangpin',
        })
    },
    changegouwuche() {
        console.log("切换购物车");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit4 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
    },
    changeshouye() {
        console.log("切换首页");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit1 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
        this.sit33 = false;
    },
    goTozanweikaifang() {
        router.push({
            uri: "pages/zanweikaifang/zanweikaifang"
        })
        console.error('Neirong'+this.neirong1);
    },
    changeguangguang() {
        console.log("切换逛逛");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit2 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
    },
    xiaoxi() {
        console.log("切换消息");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit3 = "visible";
        this.$app.$def.globalData.sit1 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
        this.sit33 = true;
    },
    goToshouye() {
        console.log("切换主页");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit1 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
        this.sit33 = false;
    },
    changeXiaoxi() {
        console.log("切换消息");
        this.$app.$def.globalData.sit1 = "hidden";
        this.$app.$def.globalData.sit2 = "hidden";
        this.$app.$def.globalData.sit3 = "hidden";
        this.$app.$def.globalData.sit4 = "hidden";
        this.$app.$def.globalData.sit5 = "hidden";
        this.$app.$def.globalData.sit3 = "visible";
        this.$app.$def.globalData.sit1 = "visible";
        this.sit1 = this.$app.$def.globalData.sit1;
        this.sit2 = this.$app.$def.globalData.sit2;
        this.sit3 = this.$app.$def.globalData.sit3;
        this.sit4 = this.$app.$def.globalData.sit4;
        this.sit5 = this.$app.$def.globalData.sit5;
        this.sit33 = true;
    }
}
